﻿using System;
using System.Collections.Generic;
using ShortcutToolbox.Core;

namespace TrafficStatisticsPlugin
{
    public class TrafficStatisticsPlugin : IPlugin
    {
        public Guid ID
        {
            get { return Guid.Parse("{C4611F87-E970-4A4D-BB3F-2F62DA76BA48}"); }
        }
        public string Version
        {
            get { return "0.1"; }
        }
        public string Name { get; set; }
        public string Description { get; set; }
        public string Catalog { get; set; } = PluginCatalogs.Network;
        public PluginStatus Status { get; set; } = PluginStatus.Visiable;
        public IList<IPluginMenu> Menus { get; set; } = new List<IPluginMenu>();
        public event EventHandler StatusChanged;

        public TrafficStatisticsPlugin()
        {
            Name = I18N.Current["TrafficStatisticsPlugin.Name"];
            Description = I18N.Current["TrafficStatisticsPlugin.Description"];
        }

        public void Init(IShortcutToolboxController controller)
        {
            PluginMenu menu = new PluginMenu { Text = "TrafficStatisticsPlugin.Menu.TrafficStatistics" };
            Menus.Add(menu);
            menu.Click += OnMenuClick;
        }

        private void OnMenuClick(object sender, EventArgs e)
        {
            new TrafficStatisticsForm().Show();
        }

        public void Uninit()
        {

        }

        public virtual void RaiseStatusChange(EventArgs e)
        {
            StatusChanged?.Invoke(this, e);
        }
    }
}
